﻿namespace ExamV5.RubricInfo
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class FrmShowRubricInfo : Page
    {
        protected Button butClose;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        private int int_0 = 0;
        protected Label labDiff;
        protected Label labEditTime;
        protected Label labEditUser;
        protected Label labFlag;
        protected Label labIsCheck;
        protected Label labIsDel;
        protected Label labIsShare;
        protected Label labOKAnswer;
        protected Label labOKMemo;
        protected Label labOptionAnswer;
        protected Label labRubricDoc;
        protected Label labRubricType;
        protected Label labSubjectName;
        private PublicFun publicFun_0 = new PublicFun();

        private void method_0()
        {
            try
            {
                int num2;
                string[] strArray;
                int num4;
                string[] strArray2;
                int num5;
                string[] strArray3;
                string str2 = "";
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                connection.Open();
                SqlCommand command = new SqlCommand("select a.IsDel,a.CreatNumberNO,a.CreatTime,a.ID,b.SubjectName,a.RubricType,a.RubricTitle,a.Difficulty,a.OptionAnswer,a.OKAnswer,a.IsShare,a.ISCheck,a.Flag,a.IsUse,a.OKMemo from RubricInfo a,SubjectInfo b  where b.ID=a.SubjectID and a.ID=" + this.int_0, connection);
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                if (!reader.Read())
                {
                    goto Label_0BEE;
                }
                this.labOKMemo.Text = reader["OKMemo"].ToString();
                if (reader["IsDel"].ToString() == "N")
                {
                    this.labIsDel.Text = "正常使用";
                }
                else
                {
                    this.labIsDel.Text = "禁止使用";
                }
                str2 = reader["OptionAnswer"].ToString();
                string str4 = reader["Flag"].ToString();
                switch (str4)
                {
                    case null:
                        goto Label_0193;

                    case "A":
                        this.labFlag.Text = "正规考试题库";
                        goto Label_0193;

                    case "B":
                        this.labFlag.Text = "练习题库";
                        goto Label_0193;

                    case "C":
                        this.labFlag.Text = "模拟考试题库";
                        break;
                }
                if (str4 == "C")
                {
                    this.labFlag.Text = "模拟考试题库";
                }
                else if (!(str4 == "D"))
                {
                    if (str4 == "E")
                    {
                        this.labFlag.Text = "每日一题题库";
                    }
                }
                else
                {
                    this.labFlag.Text = "竞赛题库";
                }
            Label_0193:
                this.labSubjectName.Text = reader["SubjectName"].ToString();
                this.labRubricType.Text = this.publicFun_0.GetRubricType(reader["RubricType"].ToString(), "0");
                switch (reader["RubricType"].ToString())
                {
                    case "A":
                        strArray3 = str2.Split(new char[] { '#' });
                        num5 = 0;
                        goto Label_046A;

                    case "B":
                        strArray2 = str2.Split(new char[] { '#' });
                        num4 = 0;
                        goto Label_0631;

                    case "C":
                        this.labOptionAnswer.Text = str2;
                        if (reader["OKAnswer"].ToString() == "Y")
                        {
                            goto Label_06AF;
                        }
                        this.labOKAnswer.Text = "错误";
                        goto Label_0A1C;

                    case "D":
                        this.labOptionAnswer.Text = str2;
                        strArray = reader["OKAnswer"].ToString().Split(new char[] { '#' });
                        num2 = 0;
                        goto Label_0879;

                    case "E":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_0A1C;

                    case "F":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_0A1C;

                    case "G":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_0A1C;

                    case "H":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                        goto Label_0A1C;

                    case "I":
                        if (!(str2.Trim() != ""))
                        {
                            goto Label_0971;
                        }
                        this.labOptionAnswer.Text = "<a href='../FrmDownLoad.aspx?FileName=" + str2 + "' target='_blank'>查看原题</a>";
                        goto Label_0981;

                    case "J":
                        this.labOptionAnswer.Text = str2;
                        this.labOKAnswer.Text = reader["OKAnswer"].ToString().Replace("#", "、");
                        goto Label_0A1C;

                    default:
                        goto Label_0A1C;
                }
            Label_02F1:
                if (strArray3[num5].ToString() != "")
                {
                    this.labOptionAnswer.Text = this.labOptionAnswer.Text + "<br>";
                    switch (num5)
                    {
                        case 0:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "A、" + strArray3[num5].ToString();
                            break;

                        case 1:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "B、" + strArray3[num5].ToString();
                            break;

                        case 2:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "C、" + strArray3[num5].ToString();
                            break;

                        case 3:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "D、" + strArray3[num5].ToString();
                            break;

                        case 4:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "E、" + strArray3[num5].ToString();
                            break;

                        case 5:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "F、" + strArray3[num5].ToString();
                            break;
                    }
                }
                num5++;
            Label_046A:
                if (num5 < strArray3.Length)
                {
                    goto Label_02F1;
                }
                this.labOKAnswer.Text = reader["OKAnswer"].ToString();
                goto Label_0A1C;
            Label_04B8:
                if (strArray2[num4].ToString() != "")
                {
                    this.labOptionAnswer.Text = this.labOptionAnswer.Text + "<br>";
                    switch (num4)
                    {
                        case 0:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "A、" + strArray2[num4].ToString();
                            break;

                        case 1:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "B、" + strArray2[num4].ToString();
                            break;

                        case 2:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "C、" + strArray2[num4].ToString();
                            break;

                        case 3:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "D、" + strArray2[num4].ToString();
                            break;

                        case 4:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "E、" + strArray2[num4].ToString();
                            break;

                        case 5:
                            this.labOptionAnswer.Text = this.labOptionAnswer.Text + "F、" + strArray2[num4].ToString();
                            break;
                    }
                }
                num4++;
            Label_0631:
                if (num4 < strArray2.Length)
                {
                    goto Label_04B8;
                }
                this.labOKAnswer.Text = reader["OKAnswer"].ToString().Replace("#", "、");
                goto Label_0A1C;
            Label_06AF:
                this.labOKAnswer.Text = "正确";
                goto Label_0A1C;
            Label_0700:
                if (strArray[num2].ToString() != "")
                {
                    this.labOKAnswer.Text = this.labOKAnswer.Text + "<br>";
                    switch (num2)
                    {
                        case 0:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "1、" + strArray[num2].ToString();
                            break;

                        case 1:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "2、" + strArray[num2].ToString();
                            break;

                        case 2:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "3、" + strArray[num2].ToString();
                            break;

                        case 3:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "4、" + strArray[num2].ToString();
                            break;

                        case 4:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "5、" + strArray[num2].ToString();
                            break;

                        case 5:
                            this.labOKAnswer.Text = this.labOKAnswer.Text + "6、" + strArray[num2].ToString();
                            break;
                    }
                }
                num2++;
            Label_0879:
                if (num2 < strArray.Length)
                {
                    goto Label_0700;
                }
                goto Label_0A1C;
            Label_0971:
                this.labOptionAnswer.Text = "";
            Label_0981:
                if (!(reader["OKAnswer"].ToString().Trim() != ""))
                {
                    this.labOKAnswer.Text = "";
                }
                else
                {
                    this.labOKAnswer.Text = "<a href='../FrmDownLoad.aspx?FileName=" + reader["OKAnswer"].ToString() + "' target='_blank'>查看答案</a>";
                }
            Label_0A1C:
                this.labRubricDoc.Text = reader["RubricTitle"].ToString();
                switch (reader["Difficulty"].ToString())
                {
                    case "A":
                        this.labDiff.Text = "难";
                        break;

                    case "B":
                        this.labDiff.Text = "较难";
                        break;

                    case "C":
                        this.labDiff.Text = "中等";
                        break;

                    case "D":
                        this.labDiff.Text = "较易";
                        break;

                    case "E":
                        this.labDiff.Text = "容易";
                        break;
                }
                if (!(reader["ISCheck"].ToString() == "N"))
                {
                    this.labIsCheck.Text = "未审核";
                }
                else
                {
                    this.labIsCheck.Text = "已审核";
                }
                if (reader["ISShare"].ToString() == "A")
                {
                    this.labIsShare.Text = "已共享";
                }
                else
                {
                    this.labIsShare.Text = "未共享";
                }
                this.labEditUser.Text = this.publicFun_0.GetValues("select UserName from UserInfo where UserCode='" + reader["CreatNumberNO"].ToString() + "'", "UserName") + "(" + reader["CreatNumberNO"].ToString() + ")";
                this.labEditTime.Text = reader["CreatTime"].ToString();
            Label_0BEE:
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
            catch
            {
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            this.int_0 = Convert.ToInt32(base.Request["ID"].ToString());
            if ((this.httpCookie_0 != null) && !(this.httpCookie_0.Value == ""))
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                if (!base.IsPostBack)
                {
                    if (!(this.publicFun_0.ReturnPaperData() != "Yes"))
                    {
                        if (!((this.int_0 != 0) ? !(this.httpCookie_2.Value != "A") : true))
                        {
                            this.method_0();
                        }
                    }
                    else
                    {
                        base.Response.Write("<script>alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')</script>");
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

